package cn.itsource.ymcc.feignclient;

import cn.itsource.ymcc.domain.Login;
import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class LoginFallbackFactory implements FallbackFactory<LoginFeignClient> {
    @Override
    public LoginFeignClient create(Throwable throwable) {
        return new LoginFeignClient() {
            @Override
            public JsonResult saveOrUpdate(Login login) {
                throwable.printStackTrace();
                return JsonResult.error("接口saveOrUpdate服务调用失败："+throwable.getMessage());
            }
        };
    }
}
